package ex;

import junit.framework.TestCase;
import org.junit.Test;

public class ComplexTest1 extends TestCase {


   Complex a = new Complex(2, 4);
        Complex b = new Complex(2, -5);

        @Test
        public void testgetRealPart()
        {
            assertEquals(2.0, a.getRealPart());
            assertEquals(2.0, b.getRealPart());
        }
        @Test
        public void testgetImagePart()
        {
            assertEquals(4.0, a.getImagePart());
            assertEquals(-5.0, b.getImagePart());
        }
        @Test
        public void testadd()
        {
            assertEquals(new Complex(4.0, -1.0).toString(), a.ComplexAdd(b).toString());
        }
        @Test
        public void testsubtract()
        {
            assertEquals(new Complex(0.0, 9.0).toString(), a.ComplexSub(b).toString());
        }
        @Test
        public void testmultiply()
        {
            assertEquals(new Complex(24.0, -2.0).toString(), a.ComplexMulti(b).toString());
        }
        @Test
        public void testdivide()
        {
            assertEquals(new Complex(1.3333333333333333, -0.1111111111111111).toString(), a.ComplexDiv(b).toString());
        }
        @Test
        public void testequals()
        {
            assertEquals(true, new Complex(2, 4).equals(a) );
        }

}